package com.cheng.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cheng.dao.SandardDao;
import com.cheng.domain.base.Standard;
import com.cheng.service.base.StandardService;

@Service
@Transactional
public class StandardServiceImpl implements StandardService {

	@Autowired
	private SandardDao standardDao;
	@Override
	@CacheEvict(value="standard",allEntries=true)
	public void addStandard(Standard standard) {
		standardDao.save(standard);
	}
	@Override
	@Cacheable(value="standard",key="#pageable.pageNumber+'_'+#pageable.pageSize")
	public Page<Standard> findAllStandardBypage(Pageable pageable) {
		return standardDao.findAll(pageable);
	}
	@Override
	@Cacheable(value="standard")
	public List<Standard> findAllStandard() {
		return standardDao.findAll();
	}


}
